

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * dyer.java
 *
 * Created on 24/04/2011, 9:42:34 PM
 */


import java.awt.AWTException;
import java.awt.Color;
import java.awt.Image;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.TrayIcon.MessageType;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Locale;

import javax.imageio.ImageIO;

import com.rsbuddy.script.ActiveScript;
import com.rsbuddy.script.Script;
import com.rsbuddy.script.methods.Environment;

/**
 *
 * @author Ollie
 */
public class dyer_UI extends javax.swing.JFrame {
	
	public boolean shouldKill = false;
	
	public boolean killScript() {
		return shouldKill;
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	TrayIcon tray;

    /** Creates new form dyer */
    public dyer_UI() {
        initComponents();
        this.addWindowListener(new WindowListener() {

			@Override
			public void windowActivated(WindowEvent w) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void windowClosed(WindowEvent w) {
				// TODO Auto-generated method stub
				setVisible(false);
				tray.getPopupMenu().getItem(0).setLabel("Display");
			}

			@Override
			public void windowClosing(WindowEvent w) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void windowDeactivated(WindowEvent w) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void windowDeiconified(WindowEvent w) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void windowIconified(WindowEvent w) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void windowOpened(WindowEvent w) {
				// TODO Auto-generated method stub
				
			}
        	
        });
    }
    
    
    
    public void setIcon() {
        try {
    	Image love = null;

	    Class<?> cls = Dyer.class;
	    Class[] argTypes = new Class[] { String.class, String.class };
    	    		Method m = cls.getDeclaredMethod("getImage", argTypes);
    	    		String[] args = new String[]{"yellow", "http://i.imgur.com/EeZou.gif"};
    	    		love = (Image) m.invoke(new Dyer(), args);
		
		PopupMenu menu = new PopupMenu();
		final MenuItem hide = new MenuItem("Hide");
		final MenuItem display = new MenuItem("Display");
		hide.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				if(hide.getLabel().contentEquals("Display")) {
				
				setVisible(true);
				tray.getPopupMenu().getItem(0).setLabel("Hide");
				} else {
					setVisible(false);
					tray.getPopupMenu().getItem(0).setLabel("Display");
				}
			}		
		});
		
		menu.add(hide);
		
		menu.addSeparator();
		
		PopupMenu subMenu = new PopupMenu("Test 2");
		subMenu.add(new MenuItem("Test 3"));
		
		menu.add(subMenu);
		
		menu.addSeparator();
		
		MenuItem exit = new MenuItem("Exit");
		
		exit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				shouldKill = true;
			}
		});
		
		menu.add(exit);
		
		tray = new TrayIcon(love, "dyer", menu);
		
			SystemTray.getSystemTray().add(tray);
			tray.displayMessage("DYER", "The script has initialised and is starting.", MessageType.INFO);
			//sleep(5000);
			// SystemTray.getSystemTray().remove(tray);
        
        } catch (Exception e2) {
			// TODO Auto-generated catch block
			e2.printStackTrace();
		}
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        state = new javax.swing.JTextField();
        timeElapsed = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        dyesMade = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        costToMake = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        profit = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        totalGained = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        lapTime = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        timeTillCompletion = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        dyesPerHour = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        timeElapsed1 = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        nextABThread = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        remainingRuns = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        updateIntervals_txt = new javax.swing.JTextField();
        updateIntervals_cmb = new javax.swing.JComboBox();
        jLabel15 = new javax.swing.JLabel();
        sellOnGE = new javax.swing.JComboBox();
        jLabel16 = new javax.swing.JLabel();
        finishingTile = new javax.swing.JComboBox();
        jPanel4 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();

        setTitle("DYER");
        setResizable(false);

        jLabel1.setLabelFor(state);
        jLabel1.setText("state");

        state.setEditable(false);
        state.setText("");

        timeElapsed.setEditable(false);
        timeElapsed.setText("");

        jLabel2.setLabelFor(timeElapsed);
        jLabel2.setText("time elapsed");

        dyesMade.setEditable(false);
        dyesMade.setText("");

        jLabel3.setLabelFor(dyesMade);
        jLabel3.setText("dyes made");

        costToMake.setEditable(false);
        costToMake.setText("");

        jLabel4.setLabelFor(costToMake);
        jLabel4.setText("cost to make");

        profit.setEditable(false);
        profit.setText("");

        jLabel5.setLabelFor(profit);
        jLabel5.setText("profit");

        totalGained.setEditable(false);
        totalGained.setText("");

        jLabel6.setLabelFor(totalGained);
        jLabel6.setText("total gained");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(dyesMade, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(state, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(timeElapsed, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel6)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(totalGained, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel5)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(profit, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addComponent(jLabel4)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(costToMake, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(29, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(state, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(timeElapsed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(dyesMade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(costToMake, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(profit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(totalGained, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addContainerGap(20, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("General", jPanel1);

        jLabel8.setLabelFor(lapTime);
        jLabel8.setText("lap time");

        lapTime.setEditable(false);
        lapTime.setForeground(new java.awt.Color(0, 255, 0));
        lapTime.setText("");
        lapTime.setToolTipText("Click to reset");

        jLabel9.setLabelFor(timeTillCompletion);
        jLabel9.setText("time till completion");

        timeTillCompletion.setEditable(false);
        timeTillCompletion.setText("");

        jLabel10.setLabelFor(dyesPerHour);
        jLabel10.setText("dyes per hour");

        dyesPerHour.setEditable(false);
        dyesPerHour.setText("");

        jLabel11.setLabelFor(timeElapsed1);
        jLabel11.setText("time elapsed");

        timeElapsed1.setEditable(false);
        timeElapsed1.setText("");

        jLabel12.setLabelFor(nextABThread);
        jLabel12.setText("next antiban thread");

        nextABThread.setEditable(false);
        nextABThread.setText("");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel12)
                    .addComponent(jLabel11)
                    .addComponent(jLabel10)
                    .addComponent(jLabel9)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lapTime)
                    .addComponent(timeTillCompletion)
                    .addComponent(dyesPerHour)
                    .addComponent(timeElapsed1)
                    .addComponent(nextABThread, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))
                .addContainerGap(26, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(lapTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(timeTillCompletion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(dyesPerHour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(timeElapsed1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(nextABThread, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(46, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Time", jPanel2);

        jLabel13.setLabelFor(remainingRuns);
        jLabel13.setText("remaining runs");

        remainingRuns.setEditable(false);
        remainingRuns.setText("");

        jLabel14.setLabelFor(updateIntervals_txt);
        jLabel14.setText("update intervals");

        updateIntervals_txt.setForeground(new java.awt.Color(255, 0, 0));
        updateIntervals_txt.setText("1");
        updateIntervals_txt.setToolTipText("Edit Update Interval for UI");
        updateIntervals_txt.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                updateIntervals_txtFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                updateIntervals_txtFocusLost(evt);
            }
        });
        updateIntervals_txt.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                updateIntervals_txtKeyReleased(evt);
            }
        });

        updateIntervals_cmb.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "millis", "seconds", "minutes", "hours" }));
        updateIntervals_cmb.setSelectedIndex(1);

        jLabel15.setLabelFor(sellOnGE);
        jLabel15.setText("sell on GE");
        jLabel15.setEnabled(false);

        sellOnGE.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "YES", "NO" }));
        sellOnGE.setSelectedIndex(1);
        sellOnGE.setEnabled(false);

        jLabel16.setLabelFor(finishingTile);
        jLabel16.setText("finishing tiles");
        jLabel16.setEnabled(false);

        finishingTile.setEditable(true);
        finishingTile.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varrock", "Grand Exchange", "Falador East Bank", "Edgeville", "Lumbridge", "Al-Kharid" }));
        finishingTile.setEnabled(false);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(remainingRuns, javax.swing.GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel16)
                            .addComponent(jLabel15)
                            .addComponent(jLabel14))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(sellOnGE, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(updateIntervals_txt, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(updateIntervals_cmb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(finishingTile, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(30, 30, 30))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(remainingRuns, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel13))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(updateIntervals_txt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(updateIntervals_cmb, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(sellOnGE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addComponent(finishingTile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(72, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Other", jPanel3);

        jPanel4.setEnabled(false);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 280, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 181, Short.MAX_VALUE)
        );

        jTabbedPane1.addTab("Login", jPanel4);
        
        Image toUse = null;
		       
        try {
    	    Class<?> cls = Dyer.class;
    	    Class[] argTypes = new Class[] { String.class, String.class };
        	    		Method m = cls.getDeclaredMethod("getImage", argTypes);
        	    		String[] args = new String[]{"logo", "http://i.imgur.com/CR8L6.png"};
        	    		toUse =  (Image) m.invoke(new Dyer(), args);
    //imgMethod.setAccessible(true);
    //toUse = (Image) imgMethod.invoke(t , new Locale("logo", "http://i.imgur.com/CR8L6.png"));
          }
          catch (Throwable e) {
             System.err.println(e);

          }
        
        jLabel7.setIcon(new javax.swing.ImageIcon(toUse)); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                    .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(18, Short.MAX_VALUE)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
        setIcon();
    }// </editor-fold>

    private void updateIntervals_txtFocusGained(java.awt.event.FocusEvent evt) {
        // TODO add your handling code here:
        updateIntervals_txt.setForeground(Color.black);
    }

    private void updateIntervals_txtFocusLost(java.awt.event.FocusEvent evt) {
        // TODO add your handling code here:
        updateIntervals_txt.setForeground(Color.red);
    }

    private void updateIntervals_txtKeyReleased(java.awt.event.KeyEvent evt) {
        // TODO add your handling code here:
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            updateIntervals_txt.transferFocus();
        }
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new dyer_UI().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    public javax.swing.JTextField costToMake;
    public javax.swing.JTextField dyesMade;
    public javax.swing.JTextField dyesPerHour;
    public javax.swing.JComboBox finishingTile;
    public javax.swing.JLabel jLabel1;
    public javax.swing.JLabel jLabel10;
    public javax.swing.JLabel jLabel11;
    public javax.swing.JLabel jLabel12;
    public javax.swing.JLabel jLabel13;
    public javax.swing.JLabel jLabel14;
    public javax.swing.JLabel jLabel15;
    public javax.swing.JLabel jLabel16;
    public javax.swing.JLabel jLabel2;
    public javax.swing.JLabel jLabel3;
    public javax.swing.JLabel jLabel4;
    public javax.swing.JLabel jLabel5;
    public javax.swing.JLabel jLabel6;
    public javax.swing.JLabel jLabel7;
    public javax.swing.JLabel jLabel8;
    public javax.swing.JLabel jLabel9;
    public javax.swing.JPanel jPanel1;
    public javax.swing.JPanel jPanel2;
    public javax.swing.JPanel jPanel3;
    public javax.swing.JPanel jPanel4;
    public javax.swing.JTabbedPane jTabbedPane1;
    public javax.swing.JTextField lapTime;
    public javax.swing.JTextField nextABThread;
    public javax.swing.JTextField profit;
    public javax.swing.JTextField remainingRuns;
    public javax.swing.JComboBox sellOnGE;
    public javax.swing.JTextField state;
    public javax.swing.JTextField timeElapsed;
    public javax.swing.JTextField timeElapsed1;
    public javax.swing.JTextField timeTillCompletion;
    public javax.swing.JTextField totalGained;
    public javax.swing.JComboBox updateIntervals_cmb;
    public javax.swing.JTextField updateIntervals_txt;
    // End of variables declaration

}

